home *** CD-ROM | disk | FTP | other *** search
- // Dynamic link library implementation of NeuroSolutions LaguerreAxon component
-
- #include "NSDLL.h"
-
- /***********************************/
- /* Forward activation of component */
-
- __declspec(dllexport) void performGammaAxon(
- DLLData *instance, // Pointer to instance data (may be NULL)
- NSFloat *data, // Pointer to the layers of processing elements (PEs), one for each memory tap
- int rows, // Number of rows of PEs in the layer
- int cols, // Number of columns of PEs in the layer
- NSFloat *delayedData, // Pointer to a PE layer delayed by a user defined time step
- int taps, // Number of memory taps specified by the user in the inspector
- NSFloat *gamma // Pointer to vector of gamma coefficients, one for each PE
- )
- {
- register int i,j,k,length=rows*cols;
-
- for (i=0; i<length; i++) {
- NSFloat gain = (NSFloat)pow(1-pow(gamma[i], 2), 0.5);
- for (j=0; j<taps; j++) {
- k = i + j*length;
- if (j==0) {
- data[k] *= gain;
- data[k] += gamma[i]*delayedData[k];
- }
- else
- data[k] = gamma[i]*delayedData[k] + delayedData[k-length] - gamma[i]*data[k-length];
- }
- }
- }
-
- /******************************************/
- /* Management of instance data (OPTIONAL) */
- /*
- __declspec(dllexport) DLLData *allocGammaAxon(
- DLLData *oldInstance, // Pointer to the last instance if reallocating
- int rows, // Number of rows of PEs in the layer
- int cols, // Number of columns of PEs in the layer
- int taps // Number of taps attached to each PE
- )
- {
- DLLData *instance = allocDLLInstance(oldInstance);
- return instance;
- }
-
- __declspec(dllexport) void freeGammaAxon(DLLData *instance)
- {
- freeDLLInstance(instance);
- }
- */